package cn.wolfcode.luowowo.acticle.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class ScenicSpot extends BaseDomain {

    public static final int STATE_FORBID = 0;  //禁用
    public static final int STATE_NORMAL = 2;  //普通
    public static final int STATE_HOT = 1;  //热门

    private Destination dest;//目的地

    private ScenicSpot parent;//有子景区的的景区

    private String title;//景区名称

    private String intro;//简介

    private String imgUrls;//封面
    private List<String> imgUrlsArr;

    private ScenicSpotTheme theme;//主题

    private Integer state = STATE_NORMAL;//状态

    private Integer replynum;//评论数

    private List<ScenicSpot> children = new ArrayList<>();//子景区

    private ScenicSpotContent content;

    private List<ScenicSpotImage> imgs=new ArrayList<>();//景区关联的图片

    private int count;//景区图片数量统计

    public List<String> getImgUrlsArr() {
        if (StringUtils.hasLength(imgUrls)) {
            List<String> list=new ArrayList<>();
            String[] splits = imgUrls.split(",");
            for (int i=1;i<splits.length;i++){
                list.add(splits[i]);
            }
            return list;
        }
        return null;
    }

}